Expand description

This crate aims to provide safe bindings to libxrandr. It currently supports reading most monitor properties.

let monitors = XHandle::open()?
    .monitors()?;

println!("{:#?}", monitors);

Example output on my laptop:

[
    Monitor {
        name: "eDP-1",
        is_primary: true,
        is_automatic: true,
        x: 0,
        y: 0,
        width_px: 1920,
        height_px: 1080,
        width_mm: 344,
        height_mm: 194,
        outputs: [
            Output {
                xid: 66,
                name: "eDP-1",
                properties: {
                    "EDID": Property {
                        name: "EDID",
                        value: Edid([ 0, 255, 255, /* ... */ 80, 68, 49, 0, 62, ]),
                        values: None,
                        is_immutable: false,
                        is_pending: false,
                    },
                    "scaling mode": Property {
                        name: "scaling mode",
                        value: Atom("Full aspect"),
                        values: Some(
                            Supported(
                                Atom(
                                    [
                                        "Full",
                                        "Center",
                                        "Full aspect",
                                    ],
                                ),
                            ),
                        ),
                        is_immutable: false,
                        is_pending: false,
                    },
                    /* ... */
                    "non-desktop": Property {
                        name: "non-desktop",
                        value: Integer32([0]),
                        values: Some(
                            Range(
                                Integer8(
                                    [
                                        Range {
                                            lower: 0,
                                            upper: 1,
                                        },
                                    ],
                                ),
                            ),
                        ),
                        is_immutable: true,
                        is_pending: false,
                    },
                },
            },
        ],
    },
]

Re-exports

pub use indexmap;

Structs

Enums